use super::model::Model;


pub struct BlogModel {
    table_name:String,
    primary_key:String
}

impl BlogModel {
    pub fn title(&self) -> &str {
        "title"
    }
    pub fn cid(&self) -> &str {
        "cid"
    }
    pub fn hits(&self) -> &str {
        "hits"
    }
    pub fn row_field(&self) -> &str {
        "id,cid,title,image,is_show,is_top,hits,created_at,updated_at"
    }
    pub fn show_row_field(&self) -> &str {
        "id,cid,title,image,description,hits,created_at"
    }
}

impl Model for BlogModel {
    fn new() ->Self {
        Self {
            table_name: "blogs".to_string(),
            primary_key: "id".to_string()
        } 
    }

    fn table(&self) -> &str {
        self.table_name.as_str()
    }
    fn primary_key(&self) -> &str {
        self.primary_key.as_str()
    }

}
